/*
 * @Author: Njpyy
 * @Date: 2024-03-16 20:38:35
 * @LastEditors: Njpyy
 * @LastEditTime: 2024-03-16 22:03:41
 * @FilePath: /big-event/src/router/index.js
 * @Description: 
 */
//导入vue-router
import { createRouter, createWebHistory } from "vue-router";

//导入组件
import LoginVue from '@/views/LoginVue.vue'
import LayoutVue from '@/views/Layout.vue'
import ArticleCategory from '@/views/article/ArticleCategory.vue'
import ArticleManage from '@/views/article/ArticleManage.vue'
import UserAvatar from '@/views/user/UserAvatar.vue'
import UserInfo from '@/views/user/UserInfo.vue'
import UserResetPassword from '@/views/user/UserResetPassword.vue'

//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    {
        path: '/',
        component: LayoutVue,
        //重定向
        redirect: '/article/manage',
        //子路由
        children: [
            {
                path: '/article/category',
                component: ArticleCategory
            },
            {
                path: '/article/manage',
                component: ArticleManage
            },
            {
                path: '/user/avatar',
                component: UserAvatar
            },
            {
                path: '/user/info',
                component: UserInfo
            },
            {
                path: '/user/password',
                component: UserResetPassword
            },

        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
